<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Doxygen: pcl::CentroidPoint&lt; PointT &gt; 模板类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Doxygen
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'搜索','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classpcl_1_1_centroid_point.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pri-attribs">Private 属性</a> &#124;
<a href="classpcl_1_1_centroid_point-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">pcl::CentroidPoint&lt; PointT &gt; 模板类 参考<div class="ingroups"><a class="el" href="group__common.html">Common components</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="centroid_8h_source.html">centroid.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:ae08dddd3a573a202f39c756dc398a436"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_centroid_point.html#ae08dddd3a573a202f39c756dc398a436">add</a> (const <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &amp;point)</td></tr>
<tr class="separator:ae08dddd3a573a202f39c756dc398a436"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9193814a144725d08ea3a0c01ac54fda"><td class="memTemplParams" colspan="2">template&lt;typename PointOutT &gt; </td></tr>
<tr class="memitem:a9193814a144725d08ea3a0c01ac54fda"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classpcl_1_1_centroid_point.html#a9193814a144725d08ea3a0c01ac54fda">get</a> (PointOutT &amp;point) const</td></tr>
<tr class="separator:a9193814a144725d08ea3a0c01ac54fda"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a40e36e9abcd63c2ae45157e8fe641189"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpcl_1_1_centroid_point.html#a40e36e9abcd63c2ae45157e8fe641189">getSize</a> () const</td></tr>
<tr class="separator:a40e36e9abcd63c2ae45157e8fe641189"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-attribs"></a>
Private 属性</h2></td></tr>
<tr class="memitem:a171d2957e3b4468e92a35565adf75a8c"><td class="memItemLeft" align="right" valign="top"><a id="a171d2957e3b4468e92a35565adf75a8c"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><b>num_points_</b></td></tr>
<tr class="separator:a171d2957e3b4468e92a35565adf75a8c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aff343aae308be3f70309ddb99a2a2c49"><td class="memItemLeft" align="right" valign="top"><a id="aff343aae308be3f70309ddb99a2a2c49"></a>
<a class="el" href="structpcl_1_1detail_1_1_accumulators.html">pcl::detail::Accumulators</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::type&#160;</td><td class="memItemRight" valign="bottom"><b>accumulators_</b></td></tr>
<tr class="separator:aff343aae308be3f70309ddb99a2a2c49"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><h3>template&lt;typename PointT&gt;<br />
class pcl::CentroidPoint&lt; PointT &gt;</h3>

<p>A generic class that computes the centroid of points fed to it.</p>
<p>Here by "centroid" we denote not just the mean of 3D point coordinates, but also mean of values in the other data fields. The general-purpose <a class="el" href="group__common.html#ga4d047d6f7b50a2d81306cc59ac927179">computeNDCentroid()</a> function also implements this sort of functionality, however it does it in a "dumb" way, i.e. regardless of the semantics of the data inside a field it simply averages the values. In certain cases (e.g. for <code>x</code>, <code>y</code>, <code>z</code>, <code>intensity</code> fields) this behavior is reasonable, however in other cases (e.g. <code>rgb</code>, <code>rgba</code>, <code>label</code> fields) this does not lead to meaningful results.</p>
<p>This class is capable of computing the centroid in a "smart" way, i.e. taking into account the meaning of the data inside fields. Currently the following fields are supported:</p>
<ul>
<li><p class="startli">XYZ (<code>x</code>, <code>y</code>, <code>z</code>)</p>
<p class="startli">Separate average for each field.</p>
</li>
<li><p class="startli"><a class="el" href="structpcl_1_1_normal.html" title="A point structure representing normal coordinates and the surface curvature estimate....">Normal</a> (<code>normal_x</code>, <code>normal_y</code>, <code>normal_z</code>)</p>
<p class="startli">Separate average for each field, and the resulting vector is normalized.</p>
</li>
<li><p class="startli">Curvature (<code>curvature</code>)</p>
<p class="startli">Average.</p>
</li>
<li><p class="startli">RGB/RGBA (<code>rgb</code> or <code>rgba</code>)</p>
<p class="startli">Separate average for R, G, B, and alpha channels.</p>
</li>
<li><p class="startli"><a class="el" href="structpcl_1_1_intensity.html" title="A point structure representing the grayscale intensity in single-channel images. Intensity is represe...">Intensity</a> (<code>intensity</code>)</p>
<p class="startli">Average.</p>
</li>
<li><p class="startli"><a class="el" href="structpcl_1_1_label.html">Label</a> (<code>label</code>)</p>
<p class="startli">Majority vote. If several labels have the same largest support then the smaller label wins.</p>
</li>
</ul>
<p>The template parameter defines the type of points that may be accumulated with this class. This may be an arbitrary PCL point type, and centroid computation will happen only for the fields that are present in it and are supported.</p>
<p>Current centroid may be retrieved at any time using <a class="el" href="classpcl_1_1_centroid_point.html#a9193814a144725d08ea3a0c01ac54fda">get()</a>. Note that the function is templated on point type, so it is possible to fetch the centroid into a point type that differs from the type of points that are being accumulated. All the "extra" fields for which the centroid is not being calculated will be left untouched.</p>
<p>Example usage:</p>
<div class="fragment"><div class="line"><span class="comment">// Create and accumulate points</span></div>
<div class="line">CentroidPoint&lt;pcl::PointXYZ&gt; centroid;</div>
<div class="line">centroid.add (<a class="code" href="structpcl_1_1_point_x_y_z.html">pcl::PointXYZ</a> (1, 2, 3);</div>
<div class="line">centroid.add (<a class="code" href="structpcl_1_1_point_x_y_z.html">pcl::PointXYZ</a> (5, 6, 7);</div>
<div class="line"><span class="comment">// Fetch centroid using `get()`</span></div>
<div class="line"><a class="code" href="structpcl_1_1_point_x_y_z.html">pcl::PointXYZ</a> c1;</div>
<div class="line">centroid.get (c1);</div>
<div class="line"><span class="comment">// The expected result is: c1.x == 3, c1.y == 4, c1.z == 5</span></div>
<div class="line"><span class="comment">// It is also okay to use `get()` with a different point type</span></div>
<div class="line"><a class="code" href="structpcl_1_1_point_x_y_z_r_g_b.html">pcl::PointXYZRGB</a> c2;</div>
<div class="line">centroid.get (c2);</div>
<div class="line"><span class="comment">// The expected result is: c2.x == 3, c2.y == 4, c2.z == 5,</span></div>
<div class="line"><span class="comment">// and c2.rgb is left untouched</span></div>
<div class="ttc" id="astructpcl_1_1_point_x_y_z_html"><div class="ttname"><a href="structpcl_1_1_point_x_y_z.html">pcl::PointXYZ</a></div><div class="ttdoc">A point structure representing Euclidean xyz coordinates. (SSE friendly)</div><div class="ttdef"><b>Definition:</b> point_types.hpp:282</div></div>
<div class="ttc" id="astructpcl_1_1_point_x_y_z_r_g_b_html"><div class="ttname"><a href="structpcl_1_1_point_x_y_z_r_g_b.html">pcl::PointXYZRGB</a></div><div class="ttdoc">A point structure representing Euclidean xyz coordinates, and the RGB color.</div><div class="ttdef"><b>Definition:</b> point_types.hpp:607</div></div>
</div><!-- fragment --><dl class="section note"><dt>注解</dt><dd>Assumes that the points being inserted are valid.</dd>
<dd>
This class template can be successfully instantiated for <em>any</em> PCL point type. Of course, each of the field averages is computed only if the point type has the corresponding field.</dd></dl>
<dl class="section author"><dt>作者</dt><dd>Sergey Alexandrov </dd></dl>
</div><h2 class="groupheader">成员函数说明</h2>
<a id="ae08dddd3a573a202f39c756dc398a436"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae08dddd3a573a202f39c756dc398a436">&#9670;&nbsp;</a></span>add()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename PointT &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classpcl_1_1_centroid_point.html">pcl::CentroidPoint</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::add </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &amp;&#160;</td>
          <td class="paramname"><em>point</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Add a new point to the centroid computation.</p>
<p>In this function only the accumulators and point counter are updated, actual centroid computation does not happen until <a class="el" href="classpcl_1_1_centroid_point.html#a9193814a144725d08ea3a0c01ac54fda">get()</a> is called. </p>
<div class="fragment"><div class="line"><a name="l01053"></a><span class="lineno"> 1053</span>&#160;      {</div>
<div class="line"><a name="l01054"></a><span class="lineno"> 1054</span>&#160;        <span class="comment">// Invoke add point on each accumulator</span></div>
<div class="line"><a name="l01055"></a><span class="lineno"> 1055</span>&#160;        boost::fusion::for_each (accumulators_, detail::AddPoint&lt;PointT&gt; (point));</div>
<div class="line"><a name="l01056"></a><span class="lineno"> 1056</span>&#160;        ++num_points_;</div>
<div class="line"><a name="l01057"></a><span class="lineno"> 1057</span>&#160;      }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a9193814a144725d08ea3a0c01ac54fda"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9193814a144725d08ea3a0c01ac54fda">&#9670;&nbsp;</a></span>get()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename PointT &gt; </div>
<div class="memtemplate">
template&lt;typename PointOutT &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classpcl_1_1_centroid_point.html">pcl::CentroidPoint</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::get </td>
          <td>(</td>
          <td class="paramtype">PointOutT &amp;&#160;</td>
          <td class="paramname"><em>point</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Retrieve the current centroid.</p>
<p>Computation (division of accumulated values by the number of points and normalization where applicable) happens here. The result is not cached, so any subsequent call to this function will trigger re-computation.</p>
<p>If the number of accumulated points is zero, then the point will be left untouched. </p>
<div class="fragment"><div class="line"><a name="l01070"></a><span class="lineno"> 1070</span>&#160;      {</div>
<div class="line"><a name="l01071"></a><span class="lineno"> 1071</span>&#160;        <span class="keywordflow">if</span> (num_points_ != 0)</div>
<div class="line"><a name="l01072"></a><span class="lineno"> 1072</span>&#160;        {</div>
<div class="line"><a name="l01073"></a><span class="lineno"> 1073</span>&#160;          <span class="comment">// Filter accumulators so that only those that are compatible with</span></div>
<div class="line"><a name="l01074"></a><span class="lineno"> 1074</span>&#160;          <span class="comment">// both PointT and requested point type remain</span></div>
<div class="line"><a name="l01075"></a><span class="lineno"> 1075</span>&#160;          <span class="keyword">typename</span> pcl::detail::Accumulators&lt;PointT, PointOutT&gt;::type ca (accumulators_);</div>
<div class="line"><a name="l01076"></a><span class="lineno"> 1076</span>&#160;          <span class="comment">// Invoke get point on each accumulator in filtered list</span></div>
<div class="line"><a name="l01077"></a><span class="lineno"> 1077</span>&#160;          boost::fusion::for_each (ca, detail::GetPoint&lt;PointOutT&gt; (point, num_points_));</div>
<div class="line"><a name="l01078"></a><span class="lineno"> 1078</span>&#160;        }</div>
<div class="line"><a name="l01079"></a><span class="lineno"> 1079</span>&#160;      }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a40e36e9abcd63c2ae45157e8fe641189"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a40e36e9abcd63c2ae45157e8fe641189">&#9670;&nbsp;</a></span>getSize()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename PointT &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">size_t <a class="el" href="classpcl_1_1_centroid_point.html">pcl::CentroidPoint</a>&lt; <a class="el" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &gt;::getSize </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Get the total number of points that were added. </p>
<div class="fragment"><div class="line"><a name="l01084"></a><span class="lineno"> 1084</span>&#160;      {</div>
<div class="line"><a name="l01085"></a><span class="lineno"> 1085</span>&#160;        <span class="keywordflow">return</span> (num_points_);</div>
<div class="line"><a name="l01086"></a><span class="lineno"> 1086</span>&#160;      }</div>
</div><!-- fragment -->
</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>common/include/pcl/common/<a class="el" href="centroid_8h_source.html">centroid.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>pcl</b></li><li class="navelem"><a class="el" href="classpcl_1_1_centroid_point.html">CentroidPoint</a></li>
    <li class="footer">制作者 <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
